<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        var date = new Date();

        var year = date.getFullYear();    //获取年份
        console.log(year);

        var month = date.getMonth() + 1;    // 获取月份，月是从0开始的
        console.log(month);

        var day = date.getDate();    // 获取日期  date
        console.log(day);

        var week = date.getDay();   // 获取星期 day   星期也是从0开始的，0表示星期天
        console.log(week);


        var hour = date.getHours();
        console.log(hour);

        var minute = date.getMinutes();
        console.log(minute);

        var second = date.getSeconds();
        console.log(second);






    </script>

</body>

</html>